package edu.zjut.hjg.saas.biz.util;

import org.springframework.util.Assert;

public class EscapeUtil {
    public static String sqlLike(String str) {
        Assert.notNull(str, "parameter [str] can not be null");
        if ("".equals(str.trim())) {
            return str;
        }
        return "%" + str.replaceAll("\\[", "[[]").replaceAll("_", "[_]").replaceAll("%", "[%]")
                + "%";
    }
}
